function format(a)
	{
	return a.substr(0,19)
}
function formatdate(a)
	{
	for(var b=[1,2,3,4,5,6,7,8,9,10,11,12],c="01,02,03,04,05,06,07,08,09,10,11,12".split(","),e=parseInt(a.substring(5,7),10),d=0;
	d<b.length;
	d++)if(e==b[d])
		{
		e=c[d];
		break
	}
	return a.substring(8,10)+"/"+e+"/"+a.substring(4,2)
}
function getRelatedNewestLinks(a)
	{
	if(a=a.feed.entry)for(var b=0;
	b<a.length;
	b++)
		{
		var c=document.createElement("li");
		c.innerHTML=showdate?'<span style="display:none;
		"> '+formatdate(a[b].published.$t)+" </span> <a href='"+a[b].link[4].href+"'>"+a[b].title.$t+"</a>":"<a href='"+a[b].link[4].href+"'>"+a[b].title.$t+"</a>";
		if(!checkRelaxLinks("related-newest-href",a[b].link[4].href))document.getElementById("related-newest-href-ul1").appendChild(c),document.getElementById("related-newest-title").innerHTML="<b>C\u00e1c b\u00e0i vi\u1ebft m\u1edbi c\u00f9ng ch\u1ee7 \u0111\u1ec1</b>";
		document.getElementById("related-posts-loading-text").style.display="none"
	}
	else document.getElementById("related-older-title").innerHTML="<b>Kh\u00f4ng c\u00f3 b\u00e0i vi\u1ebft m\u1edbi n\u00e0o c\u00f9ng ch\u1ee7 \u0111\u1ec1</b>"
}
function getRelatedOlderLinks(a)
	{
	if(a=a.feed.entry)for(var b=0;
	b<a.length;
	b++)
		{
		var c=document.createElement("li");
		c.innerHTML=showdate?" <span style='display:none;
		'>"+formatdate(a[b].published.$t)+"</span> <a href='"+a[b].link[4].href+"'>"+a[b].title.$t+"</a>":"<a href='"+a[b].link[4].href+"'>"+a[b].title.$t+"</a>";
		if(!checkRelaxLinks("related-older-href",a[b].link[4].href))document.getElementById("related-older-href-ul2").appendChild(c),document.getElementById("related-older-title").innerHTML="<b>C\u00e1c b\u00e0i vi\u1ebft c\u0169 c\u00f9ng ch\u1ee7 \u0111\u1ec1 </b>"
	}
	else document.getElementById("related-older-title").innerHTML="<b>Kh\u00f4ng c\u00f3 b\u00e0i vi\u1ebft c\u0169 n\u00e0o c\u00f9ng ch\u1ee7 \u0111\u1ec1</b>";
	document.getElementById("related-posts-loading-text").style.display="none"
}
function createRelatedJson(a,b,c,e)
	{
	var d=document.createElement("script");
	d.src="/feeds/posts/summary/-/"+escape(b)+"?orderby=published&max-results="+e+"&published-"+a+"="+escape(format(document.getElementById("post-timestamp-for-related").innerHTML))+"&alt=json-in-script&callback="+c;
	d.type="text/javascript";
	document.getElementsByTagName("head")[0].appendChild(d)
}
function checkRelaxLinks(a,b)
	{
	for(var c=!1,e=document.getElementById(a).getElementsByTagName("a"),d=0;
	d<e.length;
	d++)if(e[d].href==b)
		{
		c=!0;
		break
	}
	e=location.href.split(".html")[0]+".html";
	b==e&&(c=!0);
	return c
}
function createRP()
	{
	var a=document.getElementById("post-labels-for-related").innerHTML.split(","),b=Math.round(max_post/a.length),c=document.createElement("ul");
	c.id="related-newest-href-ul1";
	document.getElementById("related-newest-href").appendChild(c);
	for(c=0;
	c<a.length;
	c++)createRelatedJson("min",a[c],"getRelatedNewestLinks",b);
	c=document.createElement("ul");
	c.id="related-older-href-ul2";
	document.getElementById("related-older-href").appendChild(c);
	for(c=0;
	c<a.length;
	c++)createRelatedJson("max",a[c],"getRelatedOlderLinks",b)
}
createRP();
